package com.itheima.zzyl;

import com.itheima.zzyl.mapper.ReservationMapper;
import com.itheima.zzyl.pojo.PageResult;
import com.itheima.zzyl.pojo.Reservation;
import com.itheima.zzyl.pojo.Result;
import com.itheima.zzyl.service.ReservationService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.LocalDateTime;

@Slf4j
@SpringBootTest(classes = {ZzylApp.class})
public class ReservationMain {
    @Autowired
    @Qualifier(value = "reservationService")
    private ReservationService reservationService;

    @Autowired
    private ReservationMapper reservationMapper;

    @Test
    public void test() {
        Result<PageResult<Reservation>> page = reservationService.page(1, 3, 2);
        System.out.println(page);
    }

    @Test
    public void test02() {
        Reservation reservation = new Reservation();
        reservation.setName("小明");
        reservation.setMobile("12345678901");
        reservation.setCreateTime(LocalDateTime.now());
        reservation.setTime(LocalDateTime.parse("2024-12-26T18:12:20.028"));
        reservation.setVisitor("小红");
        reservation.setType(1);
        reservation.setStatus(2);
        reservation.setCreateBy(1L);
        reservation.setUpdateBy(1L);
        reservation.setRemark("备注");
//        reservationMapper.insertReservation(reservation);
        System.out.println(reservation);
//        reservationService.addReservation(reservation);
        reservationService.updateReservationStatus(294);
    }
}
